let cacheUtil = {
  setLocalStorage: function (k, v) {
    if (window.localStorage) {
      window.localStorage.setItem(k, v)
    }
  },
  getLocalStorage: function (k) {
    if (window.localStorage) {
      return window.localStorage.getItem(k)
    }
  },
  removeLocalStorage: function (k) {
    if (this.storage) {
      this.storage.removeItem(k)
    }
  },
  setSesstionStorage: function (k, v) {
    if (global.sessionStorage) {
      global.sessionStorage.setItem(k, v)
    }
  },
  getSesstionStorage: function (k) {
    if (global.sessionStorage) {
      return global.sessionStorage.getItem(k)
    }
  },
  removeSesstionStorage: function (k) {
    if (global.sessionStorage) {
      global.sessionStorage.removeItem(k)
    }
  }
}

function initIns () {
  return cacheUtil
}

export const CacheUtil = initIns()
